package com.github.facadefs.util;

import java.io.IOException;

/**
 * @since 20240522
 */
public abstract class Throwables {
    private Throwables() {
    }

    public static <T> T rethrowIOException(final Throwable cause) throws IOException {
        if (cause instanceof Error) {
            throw (Error) cause;
        }
        if (cause instanceof RuntimeException) {
            throw (RuntimeException) cause;
        }
        if (cause instanceof IOException) {
            throw (IOException) cause;
        }
        throw new IOException(cause);
    }

}
